package com.fernfx.xingtan.my.ui;

import android.content.Context;
import android.content.Intent;
import android.support.v4.content.ContextCompat;
import android.support.v7.widget.LinearLayoutCompat;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;

import com.fernfx.xingtan.R;
import com.fernfx.xingtan.common.base.BaseActivity;
import com.suke.widget.SwitchButton;
import com.xw.repo.BubbleSeekBar;

import butterknife.BindView;

import static com.baidu.mapapi.BMapManager.getContext;

/**
 * Created by admin on 2018/8/15.
 * 消息设置
 */

public class InformationSettingActivity extends BaseActivity implements SwitchButton.OnCheckedChangeListener,BubbleSeekBar.OnProgressChangedListener{
    @BindView(R.id.information_setting_bt)
    SwitchButton informationSettingBt;
    @BindView(R.id.diabolo_status_bt)
    SwitchButton diaboloStatusBt;
    @BindView(R.id.vibrate_status_bt)
    SwitchButton vibrateStatusBt;

    @BindView(R.id.vibrate_progress_bar)
    BubbleSeekBar vibrateProgressBar;
    @BindView(R.id.setting_array_lat)
    LinearLayoutCompat settingArrayLat;
    @BindView(R.id.diabolo_progress_bar)
    BubbleSeekBar diaboloProgressBar;

    public static void start(Context context) {
        Intent intent = new Intent(context, InformationSettingActivity.class);
        context.startActivity(intent);
    }

    @Override
    protected int getLayoutResId() {
        return R.layout.activity_my_setting_information;
    }

    @Override
    protected void initView() {
        setToolbarTitle("消息设置");
    }

    @Override
    protected void initListener() {
        //register listener
        informationSettingBt.setOnCheckedChangeListener(this);
        diaboloStatusBt.setOnCheckedChangeListener(this);
        vibrateStatusBt.setOnCheckedChangeListener(this);
        vibrateProgressBar.setOnProgressChangedListener(this);
        diaboloProgressBar.setOnProgressChangedListener(this);
    }

    @Override
    public void onCheckedChanged(SwitchButton view, boolean isChecked) {
        switch (view.getId()) {
            case R.id.information_setting_bt:
                if (isChecked) {
                    settingArrayLat.setVisibility(View.VISIBLE);
                } else {
                    settingArrayLat.setVisibility(View.GONE);
                }
                break;
            case R.id.diabolo_status_bt:
                if (isChecked) {
                    diaboloProgressBar.setVisibility(View.VISIBLE);
                } else {
                    diaboloProgressBar.setVisibility(View.GONE);
                }
                break;
            case R.id.vibrate_status_bt:
                if (isChecked) {
                    vibrateProgressBar.setVisibility(View.VISIBLE);
                } else {
                    vibrateProgressBar.setVisibility(View.GONE);
                }
                break;
        }
    }

    @Override
    public void onProgressChanged(BubbleSeekBar bubbleSeekBar, int progress, float progressFloat) {
        switch (bubbleSeekBar.getId()){
            case R.id.vibrate_progress_bar:
                //振动
                break;
            case R.id.diabolo_progress_bar:
                //响铃
                break;
        }
    }

    @Override
    public void getProgressOnActionUp(BubbleSeekBar bubbleSeekBar, int progress, float progressFloat) {
        switch (bubbleSeekBar.getId()){
            case R.id.vibrate_progress_bar:
                //振动
                break;
            case R.id.diabolo_progress_bar:
                //响铃
                break;
        }
    }

    @Override
    public void getProgressOnFinally(BubbleSeekBar bubbleSeekBar, int progress, float progressFloat) {
        switch (bubbleSeekBar.getId()){
            case R.id.vibrate_progress_bar:
                //振动
                break;
            case R.id.diabolo_progress_bar:
                //响铃
                break;
        }
    }
}
